<?php
/**
 * Created by PhpStorm.
 * User: Auser
 * Date: 2017/6/1
 * Time: 14:13
 */

namespace App\Admin\Extensions;

use Encore\Admin\Widgets\Chart\Chart;
use Illuminate\Support\Arr;

class timeLine extends Chart
{
    public function __construct($data = [])
    {
        $this->add($data);
    }



    public function add($label)
    {
        if (is_array($label)) {
            foreach($label as $k => $v){
                $this->data[$k] =[
                    'icon'=>empty($v[0])?"user":$v[0],
                    'title'=>empty($v[1])?" ":$v[1],
                    'content'=>empty($v[2])?[""]:$v[2],
                    'time'=>empty($v[3])?" ":$v[3],
                ];
            }
            return $this;
        }
    }
    public function render()
    {

        return view('admin.timeline', ['id' => $this->elementId, 'data' => $this->data])->render();

    }

}